<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateWorkTaskTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('work_task', function(Blueprint $table)
		{
            $table->engine = 'InnoDB';
			$table->uuid('id')->primary('id');
			$table->string('task_name', 50)->nullable()->comment('任务名称');
			$table->tinyInteger('task_type')->default(1)->comment('任务类型');
			$table->tinyInteger('task_priority')->default(1)->comment('优先级');
			$table->tinyInteger('task_status')->default(0)->comment('任务状态【代办、处理中、完成】');
			$table->tinyInteger('process_status')->default(0)->comment('步骤处理状态【开放、待分配、处理中、已解决、拒绝验收、通过验收、完成等】');
			$table->tinyInteger('solve_status')->default(0)->comment('解决状态【按时完工、超期完工、取消需求、完成、否决】');
			$table->text('task_content')->nullable()->comment('任务内容');
			$table->uuid('deal_uid')->comment('处理人');
			$table->uuid('report_uid')->comment('报告人');
			$table->timestamps();
			$table->date('expire_date')->nullable()->comment('到期日');
			$table->date('plan_start_date')->nullable()->comment('计划开始时间');
			$table->date('plan_end_date')->nullable()->comment('计划结束时间');
			$table->date('real_start_date')->nullable()->comment('实际开始时间');
			$table->date('real_end_date')->nullable()->comment('实际结束时间');
			$table->integer('plan_estimate_minute')->unsigned()->default(0)->comment('预算工时（分钟）');
			$table->integer('real_work_minute')->unsigned()->default(0)->comment('实际工作工时（分钟）');
			$table->tinyInteger('security_level')->default(0)->comment('安全级别');
			$table->tinyInteger('is_subtask')->default(0)->comment('是否为子任务');
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('work_task');
	}

}
